import { Component, OnInit } from '@angular/core';
import {ResultList} from '../result-list';
import {RequestMapping} from '../request.mapping';
import {HttpClient} from '@angular/common/http';
import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {AddMenuFormComponent} from '../add-menu-form/add-menu-form.component';
@Component({
  selector: 'app-menu',
  templateUrl: './menu.component.html',
  styleUrls: ['./menu.component.css']
})
export class MenuComponent implements OnInit {
  isCollapsed = false;
  page: any;

  _dataSet = [];
  _allChecked = false;
  _indeterminate = false;
  constructor(public modalService: NzModalService, public http: HttpClient, public messageService: NzMessageService) { }

  ngOnInit() {
    this.loadData();
  }

  private loadData() {
    this.http.get<ResultList>(RequestMapping.SYSTEM_MENUS).subscribe(response => {
      this._dataSet = response.data;
    })
  }

  private addMenu() {
    const modal = this.modalService.open(
      {
        title: "添加菜单", content: AddMenuFormComponent, footer: false
      })

    modal.on("onDestroy",() =>{
      // alert("在这重新加载");
    })



  }

  private delete(){

  }

}
